﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace KinnectInput
{
    public class Texture2DMirror
    {
        public static Texture2D MirrorTex(Texture2D orgTex, int width, int height, GraphicsDevice gDev)
        {
            Texture2D tex = new Texture2D(gDev, width, height);
            Color[] orgData = new Color[width * height];
            tex.GetData(orgData);
            List<Color> newData = new List<Color>();
            for (int y = 0; y < height; y++)
            {
                for (int x = width; x > -1; x--)
                {
                    newData.Add(orgData[y * width + x]);
                }
            }
            tex.SetData(newData.ToArray());
            return tex;
        }
        public static Texture2D MirrorTex(Color[] orgData, int width, int height, GraphicsDevice gDev)
        {
            Texture2D tex = new Texture2D(gDev, width, height);
            List<Color> newData = new List<Color>();
            for (int y = 0; y < height; y++)
            {
                for (int x = width - 1; x > -1; x--)
                {
                    newData.Add(orgData[y * width + x]);
                }
            }
            tex.SetData(newData.ToArray());
            return tex;
        }
    }
}
